/****

    activequant - activestocks.eu

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

	
	contact  : contact@activestocks.eu
    homepage : http://www.activestocks.eu

****/
package org.activequant.workflow.logic.operations;

/**
 * Holds the following associated variables:
 * <ul>
 * <li>data(Object)</li>
 * <li>operation(IOperation)</li>
 * <li>exit(boolean)</li>
 * </ul>
 * <br>
 * <b>History:</b><br>
 *  - [07.03.2007] Created (Erik Nijkamp)<br>
 *
 *  @author Erik Nijkamp
 */
public class Result {
	/**
	 * private Object data;
	 */
	private Object data;
	/**
	 * private IOperation operation;
	 */
	private IOperation operation;
	/**
	 * private boolean exit = false;
	 */
	private boolean exit = false;
	/**
	 * an empty Result constructor
	 */
	public Result() {
		
	}
	/**
	 * constructs a Result using the given exit(boolean) to set its associated exit(boolean)
	 * @param exit
	 */
	public Result(boolean exit) {
		this.exit = exit;
	}
	/**
	 * constructs a Result using the given data(Object) to set its associated data(Object)
	 * @param data
	 */
	public Result(Object data) {
		this.data = data;
	}
	/**
	 * constructs a Result using the given data(Object) and operation(IOperation) to set its associated data(Object)
	 * and operation(IOperation)
	 * @param data
	 * @param operation
	 */
	public Result(Object data, IOperation operation) {
		this.data = data;
		this.operation = operation;
	}

	/**
	 * returns the associated data(Object)
	 * @return the data
	 */
	public Object getData() {
		return data;
	}
	
	/**
	 * returns whether the associated data(Object) is not null
	 * @return has data
	 */
	public boolean hasData() {
		return data != null;
	}

	/**
	 * sets the associated data(Object) with the given data(Object)
	 * @param data the data to set
	 */
	public void setData(Object data) {
		this.data = data;
	}

	/**
	 * returns the associated operation(IOperation)
	 * @return the operation
	 */
	public IOperation getOperation() {
		return operation;
	}

	/**
	 * sets the associated operation(IOperation) with the given operation(IOperation)
	 * @param operation the operation to set
	 */
	public void setOperation(IOperation operation) {
		this.operation = operation;
	}
	
	/**
	 * returns whether the associated operation(IOperation) is not null
	 * @return has operation
	 */
	public boolean hasOperation() {
		return operation != null;
	}
	
	/**
	 * returns the associated exit(boolean)
	 * @return end?
	 */
	public boolean isExit() {
		return exit;
	}
}
